#include <stdio.h>

int main()
{
	int score = 0;
	srand((unsigned)time(NULL));//随机数种
	for (int i = 1; i <= 10; i++)
	{
		int num1, //运算数1
			num2, //运算数2
			answer, //答案
			opFlg;//运算符标志位
		char op;//运算符
		num1 = rand() % 51;
		opFlg = rand() % 2;
		num2 = rand() % 51;

		while (1)
		{
			if (opFlg)
			{
				op = '+';
				if (num1 + num2 > 50)
				{
					opFlg = rand() % 2;
					num2 = rand() % 51;
				}
				else
				{
					answer = num1 + num2;
					break;
				}
			}
			else
			{
				op = '-';
				if (num1 - num2 < 0)
				{
					opFlg = rand() % 2;
					num2 = rand() % 51;
				}
				else
				{
					answer = num1 - num2;
					break;
				}
			}
		}

		int j, result;
		for (j = 1; j <= 3; j++)
		{
			printf_s("%d %c %d = ", num1, op, num2);
			scanf("%i", &result);
			if (result == answer)
			{
				break;
			}
			else
			{
				printf_s("错误！请重做\n");
			}
		}

		switch (j)
		{
		case 1:
			score += 10;
			break;
		case 2:
			score += 7;
			break;
		case 3:
			score += 5;
			break;
		default:
			break;
		}
	}

	if (score >= 90)
	{
		printf_s("SMART\n");
	}
	else if (score >= 80 && score < 90)
	{
		printf_s("GOOD\n");
	}
	else if (score >= 70 && score < 80)
	{
		printf_s("OK\n");
	}
	else if (score >= 60 && score < 70)
	{
		printf_s("PASS\n");
	}
	else
	{
		printf_s("TRY AGAIN\n");
	}

	system("pause");
	return 0;
}